package com.mallcloud.mall.converter;

import com.mallcloud.mall.product.api.dto.SpuPublishDTO;
import com.mallcloud.mall.product.api.entity.SpuAttrValueModel;
import com.mallcloud.mall.product.api.vo.AppSpuVO;
import com.mallcloud.mall.product.api.entity.SpuModel;
import com.mallcloud.mall.product.api.vo.AttrExtendVO;
import com.mallcloud.mall.product.api.vo.SpuVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "Spring")
public interface SpuConverter {

    SpuConverter INSTANCE = Mappers.getMapper(SpuConverter.class);

    SpuVO ModelToVO(SpuModel spu);

    AppSpuVO VOToVO(SpuVO spu);

    @Mappings({
            @Mapping(source = "brandId", target = "brandId"),
    })
    SpuModel DTOToModel(SpuPublishDTO dto);

    SpuAttrValueModel VOToModel(AttrExtendVO x);

}
